<?php
namespace app\customer\model;

use app\BaseModel;

class LongbingCardQuestion extends BaseModel
{
    //定义表名称
    protected $name = 'longbing_card_qn_question';
    
    public function searchContentAttr($query, $value, $data)
    {
        $query->where('content','like', '%' . $value . '%');
    }
    public function questionnaire()
    {
        return $this->belongsTo('LongbingCardQuestionnaire' ,'naire_id' ,'id');
    }
    //创建
    public function createQuestion($data)
    {
        $data['create_time'] = time();
        $result = $this->save($data);
        return !empty($result);
    }
    public function delQuestion($filter)
    {
        $result = $this->where($filter)->delete();
        return !empty($result);
    }
    public function delQuestionById($filter)
    {
        $result = $this->where('id' ,'in' ,$filter)->delete();
        return !empty($result);
    }
    public function updateQuestion($filter ,$data)
    {
        $data['update_time'] = time();
        $result = $this->where($filter)->update($data);
        return !empty($result);
    }
}